//
//  UserProfileViewModel.swift
//  User
//
//  Created by ET|冰琳 on 2017/1/9.
//  Copyright © 2017年 IB. All rights reserved.
//

import Foundation
import ReactiveSwift

open class UserProfileViewModel<T: UserProfileService>: NSObject where T.UserProfileGetResult == UserEntity {
    
    open var user: T.UserProfileGetResult?
    
    private var service: T
    
    /// - Parameter service: UserProfileService
    public init(service: T) {
        self.service = service
    }
    
    open func getProfile(crediatal: [String : Any]? = nil) -> SignalProducer<T.UserProfileGetResult, NSError>{
        return self.service.getProfile(crediatal: crediatal)
    }
    
    open func updateProfile(user: [String : Any]? = nil) -> SignalProducer<T.UserProfileUpdateResult, NSError>{
        return self.service.update(user: user)
    }
}
